/*
任务：用单链表保存m个整数data，且|data| <= n, 设计一个高效的算法
对于链表中data绝对值相同的节点，仅保留第一次出现而删除其余绝对值相同的节点
*/
#include <bits/stdc++.h>
using namespace std;

typedef struct LNode
{
    int data;
    struct LNode *next;
}LNode, *ListNode;

void Init(ListNode &L)
{
    L = new LNode;
    L->next = NULL;
}

void Create(ListNode &L, int m)
{
    LNode *t = L;
    while(m--)
    {
        LNode *p = new LNode;
        cin >> p->data;
        p->next = t->next;
        t->next = p;
        t = p;
    }
}

void Show(ListNode L)
{
    LNode *p = L->next;
    while(p)
    {
        cout << p->data << " ";
        p = p->next;
    }
    cout << endl;
}
void func(ListNode &L, int n)
{
    if(!L || !L->next) return;
    unordered_set<int> v;
    LNode *pre = L, *cur = L->next;

    while(cur)
    {
        int x = abs(cur->data);
        
        if(v.find(x) == v.end())
        {
            v.insert(x);
            pre = cur;
            cur = cur->next;
        }
        else
        {
            pre->next = cur->next;
            delete cur;
            cur = pre->next;
        }
    }
}
int main()
{
    ListNode L;
    Init(L);
    int m; cin >> m;
    Create(L, m);
    func(L, 1000);
    Show(L);

    return 0;
}